package no.sachmuld.methodcombination.examples.reflection.roles.employee.lib;

import no.sachmuld.methodcombination.examples.reflection.roles.employee.api.*;

/**
 *
 */
public class EmployeeServiceImpl implements EmployeeService {

    @Override
    public Employee createEmployee(int salary) {
        return new EmployeeImpl(salary);
    }

    @Override
    public Employee createEmployeeWithRole(int salary, Class<? extends EmployeeRole>... roles) {
        EmployeeImpl employee = new EmployeeImpl(salary);
        for (Class<? extends EmployeeRole> roleInterface : roles) {
            if (roleInterface == Manager.class) {
                employee.with(new ManagerImpl());
            } else if (roleInterface == Consultant.class) {
                employee.with(new ConsultantImpl());
            }
        }
        return employee;
    }

}
